<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <body>

        <ui:composition template="./../Template/generalTemplate.xhtml">

            <ui:define name="content">

                <h:form id="form">
                    <f:view beforePhase="#{toQuotationManagedBean.initView}">
                        <p:panel id="quotation" header="Raise Sales Quotation" style="height:495px;">
                            <div style="margin:20px;">
                                <h3>
                                    <h:outputText value="Company:" /><p:spacer width="10px" />
                                    <h:outputText value="#{toQuotationManagedBean.quotation.company.name}" />
                                </h3>
                                <p:dataTable id="quotationView" dynamic="true" emptyMessage="No Items to display" value="#{toQuotationManagedBean.quotation.quotationLineItems}" var ="lineItem">
                                    <p:column>
                                        <f:facet name="header">Product</f:facet>
                                        #{lineItem.product.productName}
                                    </p:column>

                                    <p:column>
                                        <f:facet name="header">Quantity (in cases)</f:facet>
                                        <p:inplace editor="true" onEditUpdate="msgs">
                                            <p:inputText value="#{lineItem.quantity}" />
                                        </p:inplace>
                                    </p:column> 

                                    <p:column>
                                        <f:facet name="header">Unit Price after Discount</f:facet>
                                        #{lineItem.price}
                                    </p:column>   
                                </p:dataTable>
                                <br /> 
                                <p:commandButton value="Proceed"  ajax="false" actionListener="#{toQuotationManagedBean.proceed}" />
                            </div>
                        </p:panel>
                    </f:view>
                </h:form>

            </ui:define>


        </ui:composition>

    </body>
</html>
